import { Component, OnInit } from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {ServiceLogicService} from '../../service/service-logic.service';
import {Subscription} from 'rxjs';
import {Router} from '@angular/router';
@Component({
  selector: 'app-executivestaff',
  templateUrl: './executivestaff.component.html',
  styleUrls: ['./executivestaff.component.css']
})
export class  ExecutivestaffComponent implements OnInit {
  data : any;
  admin_id = "623456";
  warning = "please clock";
  flag=0;
  
  date = new Date();
  dk() {
    this.flag=1;
    this.warning = "clocked";
        const punchRecord = {
          admin_id: "623456",
          dept_no: "002",
          year: this.date.getFullYear().toString(),
          month: (this.date.getMonth() + 1).toString(),
          day: this.date.getDate().toString(),
          time: this.date.getHours().toString() + ':' + this.date.getMinutes().toString()
        };
        console.log(punchRecord);
        this.logicService.addPunchInRecord(punchRecord)
          .then(response2 => {
            if (punchRecord) { alert('签到成功！'); }
          });
  }
  constructor(private activateRoute: ActivatedRoute, 
    private logicService: ServiceLogicService) { }

  ngOnInit() {
    console.log(new Date());
  }
}